#coding:utf-8

from flask import Flask
app=Flask(__light__)
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(14,GPIO.OUT)
GPIO.output(14,GPIO.HIGH)


@app.route("/")
def index():
  return """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>小灯控制台</title>

<link href='http://fonts.useso.com/css?family=Poiret+One' rel='stylesheet' type='text/css'/>
<link href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/font-awesome.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/animate.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/magnific-popup.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/style.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/responsive.css"/>

</head>
<body>

<div id="loader-wrapper">
<div id="loader"></div>
<div id="ie9-loader"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/bx_loader.GIF" alt="loader"></div>
</div>

<div class="main-wrapper bg-wrapper" data-mainbg="http://7xnis6.com1.z0.glb.clouddn.com/images/main-bg.jpg">

<div class="overlay"></div>

<div class="page-wrapper home-page vm">

<div id="home" class="vm-item">
<div class="container">

 <div class="tag-line">
 <section class="cd-intro">
<h1 class="cd-headline zoom">
<span class="cd-words-wrapper">
<b class="is-visible">
<span class="bold" style="font-family:微软雅黑">欢迎来到小灯控制台<br><a href="http://192.168.2.122/on">点击开灯</a><br><a href="http://192.168.2.122/off">点击关灯</a></span>
</b>
</span>
</h1>
</section>
 </div>

</div>


</div>

</div>
<div class="front-display">

 <div class="logo">
 <a href="index.html"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/logo.png" alt="Logo"></a>
 </div>
 
<ul class="social-icon">
<li class="facebook">
<a class="vhm circle-icon" href="#">
<i class="fa fa-facebook vhm-item"></i>
</a>
</li>
<li class="twitter">
<a class="vhm circle-icon" href="#">
<i class="fa fa-twitter vhm-item"></i>
</a>
</li>
<li class="google-plus">
<a class="vhm circle-icon" href="#">
<i class="fa fa-google-plus vhm-item"></i>
</a>
</li>
</ul>

</div>

<footer class="footer">
<p><span class="vhm">小灯控制程序</span> <i class="fa fa-coffee"></i><a href="http://www.chenxublog.com/" >by 晨旭</a></p>
</footer>

</div>

<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery-1.11.2.min.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/plugins.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.lwtCountdown-1.0.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/main.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/notifyMe.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.stapel.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/common.js"></script>

</body>
</html>"""

@app.route("/index.html")
def indexhtml():
  return """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>小灯控制台</title>

<link href='http://fonts.useso.com/css?family=Poiret+One' rel='stylesheet' type='text/css'/>
<link href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/font-awesome.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/animate.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/magnific-popup.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/style.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/responsive.css"/>

</head>
<body>

<div id="loader-wrapper">
<div id="loader"></div>
<div id="ie9-loader"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/bx_loader.GIF" alt="loader"></div>
</div>

<div class="main-wrapper bg-wrapper" data-mainbg="http://7xnis6.com1.z0.glb.clouddn.com/images/main-bg.jpg">

<div class="overlay"></div>

<div class="page-wrapper home-page vm">

<div id="home" class="vm-item">
<div class="container">

 <div class="tag-line">
 <section class="cd-intro">
<h1 class="cd-headline zoom">
<span class="cd-words-wrapper">
<b class="is-visible">
<span class="bold" style="font-family:微软雅黑">欢迎来到小灯控制台<br><a href="http://192.168.2.122/on">点击开灯</a><br><a href="http://192.168.2.122/off">点击关灯</a></span>
</b>
</span>
</h1>
</section>
 </div>

</div>


</div>

</div>
<div class="front-display">

 <div class="logo">
 <a href="index.html"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/logo.png" alt="Logo"></a>
 </div>
 
<ul class="social-icon">
<li class="facebook">
<a class="vhm circle-icon" href="#">
<i class="fa fa-facebook vhm-item"></i>
</a>
</li>
<li class="twitter">
<a class="vhm circle-icon" href="#">
<i class="fa fa-twitter vhm-item"></i>
</a>
</li>
<li class="google-plus">
<a class="vhm circle-icon" href="#">
<i class="fa fa-google-plus vhm-item"></i>
</a>
</li>
</ul>

</div>

<footer class="footer">
<p><span class="vhm">小灯控制程序</span> <i class="fa fa-coffee"></i><a href="http://www.chenxublog.com/" >by 晨旭</a></p>
</footer>

</div>

<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery-1.11.2.min.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/plugins.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.lwtCountdown-1.0.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/main.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/notifyMe.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.stapel.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/common.js"></script>

</body>
</html>"""


@app.route("/on")
def on():
  GPIO.output(14,GPIO.LOW)
  return """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>小灯控制台</title>

<link href='http://fonts.useso.com/css?family=Poiret+One' rel='stylesheet' type='text/css'/>
<link href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/font-awesome.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/animate.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/magnific-popup.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/style.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/responsive.css"/>

</head>
<body>

<div id="loader-wrapper">
<div id="loader"></div>
<div id="ie9-loader"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/bx_loader.GIF" alt="loader"></div>
</div>

<div class="main-wrapper bg-wrapper" data-mainbg="http://7xnis6.com1.z0.glb.clouddn.com/images/main-bg.jpg">

<div class="overlay"></div>

<div class="page-wrapper home-page vm">

<div id="home" class="vm-item">
<div class="container">

 <div class="tag-line">
 <section class="cd-intro">
<h1 class="cd-headline zoom">
<span class="cd-words-wrapper">
<b class="is-visible">
<span class="bold" style="font-family:微软雅黑">小灯已开启<br><a href="http://192.168.2.122/off">点击关灯</a></span>
</b>
</span>
</h1>
</section>
 </div>

</div>


</div>

</div>
<div class="front-display">

 <div class="logo">
 <a href="index.html"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/logo.png" alt="Logo"></a>
 </div>
 
<ul class="social-icon">
<li class="facebook">
<a class="vhm circle-icon" href="#">
<i class="fa fa-facebook vhm-item"></i>
</a>
</li>
<li class="twitter">
<a class="vhm circle-icon" href="#">
<i class="fa fa-twitter vhm-item"></i>
</a>
</li>
<li class="google-plus">
<a class="vhm circle-icon" href="#">
<i class="fa fa-google-plus vhm-item"></i>
</a>
</li>
</ul>

</div>

<footer class="footer">
<p><span class="vhm">小灯控制程序</span> <i class="fa fa-coffee"></i><a href="http://www.chenxublog.com/" >by 晨旭</a></p>
</footer>

</div>

<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery-1.11.2.min.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/plugins.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.lwtCountdown-1.0.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/main.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/notifyMe.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.stapel.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/common.js"></script>

</body>
</html>"""

@app.route("/off")
def off():
  GPIO.output(14,GPIO.HIGH)
  return """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>小灯控制台</title>

<link href='http://fonts.useso.com/css?family=Poiret+One' rel='stylesheet' type='text/css'/>
<link href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/font-awesome.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/animate.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/magnific-popup.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/style.css"/>
<link rel="stylesheet" type="text/css" href="http://7xnis6.com1.z0.glb.clouddn.com/css/responsive.css"/>

</head>
<body>

<div id="loader-wrapper">
<div id="loader"></div>
<div id="ie9-loader"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/bx_loader.GIF" alt="loader"></div>
</div>

<div class="main-wrapper bg-wrapper" data-mainbg="http://7xnis6.com1.z0.glb.clouddn.com/images/main-bg.jpg">

<div class="overlay"></div>

<div class="page-wrapper home-page vm">

<div id="home" class="vm-item">
<div class="container">

 <div class="tag-line">
 <section class="cd-intro">
<h1 class="cd-headline zoom">
<span class="cd-words-wrapper">
<b class="is-visible">
<span class="bold" style="font-family:微软雅黑">小灯已关闭<br><a href="http://192.168.2.122/on">点击开灯</a></span>
</b>
</span>
</h1>
</section>
 </div>

</div>


</div>

</div>
<div class="front-display">

 <div class="logo">
 <a href="index.html"><img src="http://7xnis6.com1.z0.glb.clouddn.com/images/logo.png" alt="Logo"></a>
 </div>
 
<ul class="social-icon">
<li class="facebook">
<a class="vhm circle-icon" href="#">
<i class="fa fa-facebook vhm-item"></i>
</a>
</li>
<li class="twitter">
<a class="vhm circle-icon" href="#">
<i class="fa fa-twitter vhm-item"></i>
</a>
</li>
<li class="google-plus">
<a class="vhm circle-icon" href="#">
<i class="fa fa-google-plus vhm-item"></i>
</a>
</li>
</ul>

</div>

<footer class="footer">
<p><span class="vhm">小灯控制程序</span> <i class="fa fa-coffee"></i><a href="http://www.chenxublog.com/" >by 晨旭</a></p>
</footer>

</div>

<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery-1.11.2.min.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/plugins.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.lwtCountdown-1.0.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/main.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/notifyMe.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/jquery.stapel.js"></script>
<script src="http://7xnis6.com1.z0.glb.clouddn.com/js/common.js"></script>

</body>
</html>"""

if __name__=="__main__":
  app.run(host="0.0.0.0",port=80,debug=True)
